//
//  String+Extension.swift
//  SinaWeibo
//
//  Created by 郭平 on 15/10/17.
//  Copyright © 2015年 郭平. All rights reserved.
//

import Foundation
import UIKit

extension String {
    
    func size(font: UIFont, constrainedToSize: CGSize = CGSizeZero) ->CGSize {
     
        let string = self as NSString
        
        let attr = [
            NSFontAttributeName: font
        ]
        
        return string.boundingRectWithSize(constrainedToSize, options: [NSStringDrawingOptions.UsesLineFragmentOrigin], attributes: attr, context: nil).size
    }
}